<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="cn.netjava.pojo.Msg"%>
<%@page import="cn.netjava.pojo.User;"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>this is user's msg page</title>
    <link rel="stylesheet" type="text/css" href="css/personmsg.css" />
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
     <div>
       <div id="front">
          <jsp:include page="personfront.jsp"></jsp:include>
       </div>  
        
       <%List<Msg> msgList =(List<Msg>)request.getAttribute("usermsglist");%>
       <div id="main">
           <%if(0!=msgList.size()){
           for(Msg msg:msgList){ %>
           <div class="center">
              <div class="left">
                  <img src="<%=msg.getUser().getUserPhoto() %>" width="114" height="114" />
              </div>
              
              
              <div class="right">
                  <div class="content">
                      <div class="content_con"><%=msg.getUser().getUserName()+"的留言:"+msg.getMsgContent() %></div>
                      <hr><div class="content_time"><%="留言时间："+msg.getInt_dt() %></div>
                  </div>
                  
                  <div class="msg">
                      <input type="button" value="回复" onclick="javascript:window.location.href='replaymsg.jsp'"/>
                  </div>
              </div>
           </div>
           <%}}else{ %>
           <div class="center">
              <div class="left">
              </div>
              
              <div class="right">
                  <div class="content">
                            主人还没有收到留言，请你留言！！！<br>
                  </div>
              </div>
           </div>
           <%} %>
           
           <%User loginUser =(User)session.getAttribute("loginUser"); 
             if(null!=loginUser){%>
             <div class="center">
              <div class="right">
                  <form action="writemsg.cn" method="POST">
	                  <div class="content">
	                     <textarea rows="5" cols="55" name="msgcontent"></textarea>
	                  </div>
	                  
	                  <div class="msg">
	                      <input type="hidden" name="uid" value="<%=request.getParameter("uid") %>" />
	                      <input type="submit" value="我要留言" />
	                  </div>
                  </form>
              </div>
           </div>
           <%} else{%>
           对不起，你还没有登陆，不能执行这个操作！！！
           <%} %>
       </div>
       
       <jsp:include page="../footer.jsp"></jsp:include>
    </div> 
  </body>
</html>
